package org.trendit

class TagController {
	def scaffold = true
    //def index() { }
	def search = {
	
     }
	def results = {
//		def tags = Tag.find(params.tag)
//		return [ tags: tags, term : params.tag ]
		
		def mytag = Tag.findByName(params.tag)
//		mytag.posts.each { post ->
//		   println "User $user.username has role $role.name"
//		}
		return [posts:mytag.posts, term : params.tag]
	}
	
	def timeline = {
		def mytag = Tag.findByName(params.id)
		def user = User.findByUserId(params.id)
		 [myposts:mytag.posts, term:mytag]
	}
}
